package com.hoshiicloud.payment.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;

public class AlipayConfig {
    public static boolean isDebug=true;

    public static String url;

    public static String appID;

    public static String appPrivateKey;

    public static String format="json";

    public static String charset;

    public static String alipayPublicKey;

    public static String signType;

    @Value("${alipay.url}")
    public static void setUrl(String url) {
        AlipayConfig.url = url;
    }
    @Value("${alipay.appID}")
    public static void setAppID(String appID) {
        AlipayConfig.appID = appID;
    }
    @Value("${alipay.appPrivateKey}")
    public static void setAppPrivateKey(String appPrivateKey) {
        AlipayConfig.appPrivateKey = appPrivateKey;
    }
    @Value("${alipay.charset}")
    public static void setCharset(String charset) {
        AlipayConfig.charset = charset;
    }
    @Value("${alipay.alipayPublicKey}")
    public static void setAlipayPublicKey(String alipayPublicKey) {
        AlipayConfig.alipayPublicKey = alipayPublicKey;
    }
    @Value("${alipay.signType}")
    public static void setSignType(String signType) {
        AlipayConfig.signType = signType;
    }

    public static AlipayClient getDefaultAlipayClient() {
        AlipayClient alipayClient=new DefaultAlipayClient(url,appID,appPrivateKey,format,charset,alipayPublicKey,signType);
        return alipayClient;
    }
}
